package org.glandais.profiler.beans;

import java.util.ArrayList;
import java.util.List;

public class ProcessingList {

	public List<ProcessingTrace> processingTraces = new ArrayList<ProcessingTrace>();
	private transient ProcessingTrace trace = null;

	private int counter = 0;

	public final void startProcessing() {
		if (counter == 0) {
			trace = new ProcessingTrace();
		}
		counter++;
	}

	public final void stopProcessing() {
		counter--;
		if (counter == 0) {
			processingTraces.add(null);
			processingTraces.set(processingTraces.size() - 1, trace
					.endProcess());
		}
	}

}
